/**
 * @param {number[]} nums
 * @return {number}
 */
var findRepeatNumber = function (nums) {
  for (let i = 0; i < nums.length; i++) {
    if (nums.indexOf(nums[i]) != i) return nums[i]
  }
}

// 置换方法
findRepeatNumber = function (nums) {
  var tmp
  for (let i = 0; i < nums.length; i++) {
    while (nums[i] != i) {
      if(nums[i] == nums[nums[i]]) return nums[i]
      tmp = nums[i]
      nums[i] = nums[tmp]
      nums[tmp] = tmp
    }
  }
}
